Skip to content

Comments

Feat more performant insert rows#17

Open
uberl wants to merge 6 commits intovlucas:mainfrom
uberl:feat-more-performant-insertRows
Open

Feat more performant insert rows#17
uberl wants to merge 6 commits intovlucas:mainfrom
uberl:feat-more-performant-insertRows

Conversation

@uberl
Copy link

@uberl uberl commented Sep 18, 2024

I couldn't manage to use LockService API, i had no idea how to mock that. :-(

The new implementation for insertRows() inserts empty Rows and sets the values for the range explicitly if there are enough new rows to be inserted (currently >3). Otherwise sheet.appendRow will be called for each row.

Added a new unit test for insertRows to check this case: Gas does not provide an implementation for sheet.insertRowsAfter() and sheet.getRange().setValues(). So, instead the internal _sheet is overwritten ad hoc. I hate my solution!

updating jest version was necessary
test explicitly overwrites private _sheet and doesn't mock spreadsheet behaviour for ranges and setting values on ranges
There was a type resolution conflict for type Mimetype for gas types.
This default should work according to clasp documentation:
https://github.com/google/clasp/blob/master/docs/typescript.md#typescript-configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant